package com.xiaoxi.bridgemode;

import com.xiaoxi.bridgemode.function.CountDisplay;
import com.xiaoxi.bridgemode.function.Display;
import com.xiaoxi.bridgemode.function.RandomDisplay;
import com.xiaoxi.bridgemode.realization.CharDisplayImpl;
import com.xiaoxi.bridgemode.realization.FileDisplayImpl;
import com.xiaoxi.bridgemode.realization.StringDisplayImpl;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.bridgemode
 * @ClassName Main
 * @Description TODO
 * @Date 2023/3/13 19:37
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        Display display = new Display(new StringDisplayImpl("hello world!"));
        display.display();
        CountDisplay countDisplay = new CountDisplay(new StringDisplayImpl("hello world!"));
        countDisplay.countDisplay(5);
        RandomDisplay randomDisplay = new RandomDisplay(new StringDisplayImpl("hello world!"));
        randomDisplay.randomDisplay(5);
        try {
            Display display2 = new Display(new FileDisplayImpl(new BufferedInputStream(new FileInputStream("百度一下.html"))));
            display2.display();
        } catch (FileNotFoundException e) {
            System.out.println("文件找不到");
        }
        CountDisplay countDisplay1 = new CountDisplay(new CharDisplayImpl('<','*','>'));
        countDisplay1.countDisplay(2);
        CountDisplay countDisplay2 = new CountDisplay(new CharDisplayImpl('|','#','-'));
        countDisplay2.countDisplay(5);
    }
}
